package SquarePackage;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;

import java.math.BigDecimal;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import Border.Door;



/**
 * Een testklasse voor de klasse Square.
 * Deze bevat alle testmethoden om setters en speciale mutators
 * te controleren van de klasse 'transparant vakje'.
 * 
 * @author      Nathan Bekaert & Philippe de Potter de ten Broeck
 * @version 1.0
 */
public class TransparentSquareTest {
        
        TransparentSquare transparant1;
        TransparentSquare transparant2;
        TransparentSquare transparant3;
		private TransparentSquare transparant4;
		private TransparentSquare transparant5;

        @Before
        public void setUp() throws Exception {
        		Door door = new Door(transparant1,Direction.EAST);
                transparant1 = new TransparentSquare(0,BigDecimal.ZERO,TemperatureScale.CELSIUS,door,Direction.EAST);
                transparant2 = new TransparentSquare(0, BigDecimal.valueOf(10),TemperatureScale.CELSIUS, Direction.WEST, true);
                transparant3 = new TransparentSquare(0,new BigDecimal(50.00),TemperatureScale.CELSIUS, Direction.NORTH, false);
                transparant4 = new TransparentSquare();
                transparant5 = new TransparentSquare(0,BigDecimal.ZERO);
        }


        
        //Random testing, actually only important thing is that all the constructors work
        
        @Test
        public void testColdDamage()throws Exception{
                transparant1.setTemperature(new Temperature(20));
                assertEquals(transparant1.coldDamage(), 0);
                transparant1.setTemperature(new Temperature(-16));
                assertEquals(transparant1.coldDamage(), 1);
                transparant1.setTemperature(new Temperature(-91));
                assertEquals(transparant1.coldDamage(), 8);
        }
        @Test
        public void testHeatDamage()throws Exception{
                transparant1.setTemperature(20);
                assertEquals(transparant1.heatDamage(), 0);
                transparant1.setTemperature(51);
                assertEquals(transparant1.heatDamage(), 1);
                transparant1.setTemperature(118);
                assertEquals(transparant1.heatDamage(), 5);
        }
}